<template>

  <el-tabs style="height: 100%;">
    <el-tab-pane label="收件箱">
      <!--收件箱-->
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="DisplayName" label="发件人昵称" width="300">
        </el-table-column>
        <el-table-column prop="Address" label="发件人邮箱地址" width="300">
        </el-table-column>
        <el-table-column prop="Subject" label="邮箱标题" width="300">
        </el-table-column>
        <el-table-column prop="Date" label="发件时间" width=" 200">
        </el-table-column>
        <el-table-column v-if="show" prop="BodyHtmlText" label="内容" width="200">
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="200">
          <template slot-scope="scope">
            <el-button type="primary" @click="handleClick(scope.row)" size="mini">查看</el-button>
          </template>
        </el-table-column>

      </el-table>
      <el-dialog :modal="false" title="邮件内容" :visible.sync="MailConent">
        <div v-if="Body" v-html="Body">

        </div>
      </el-dialog>
    </el-tab-pane>
    <el-tab-pane label="发件箱">
      <!--发件箱-->
      <el-table :data="tableData1" height="500" style="width: 100%">
        <el-table-column prop="MailTo" label="收件人邮箱地址" width="400">
        </el-table-column>
        <el-table-column prop="Subject" label="邮箱标题" width="400">
        </el-table-column>
        <el-table-column prop="SentDate" label="发件时间" width="200">
        </el-table-column>
        <el-table-column v-if="show" prop="Body" label="内容">
        </el-table-column>
        <el-table-column fixed="right" label="操作" min-width="200">
          <template slot-scope="scope">
            <div>
              <el-button type="primary" @click="handleClick1(scope.row)" size="mini">查看</el-button>
            </div>

          </template>
        </el-table-column>

      </el-table>
      <el-dialog :modal="false" title="邮件内容" :visible.sync="MailConent">
        <div v-if="Body" v-html="Body">

        </div>
      </el-dialog>
    </el-tab-pane>
  </el-tabs>

</template>
<script>
export default {
  data () {
    return {
      tableData: [{
        Address: null,
        Subject: null,

      }], tableData1: [{
      }],
      MailConent: false,
      MailConent1: false,
      Body: '',
      show: false
    }
  }, methods: {
    handleClick (row) {
      this.MailConent = true
      this.Body = row.BodyHtmlText
    },
    handleClick1 (row) {
      this.MailConent = true
      this.Body = row.Body
    }
  },
  mounted () {
    this.$axios({
      url: '/HrApi/Mail/Mail',
      method: 'Get'
    }).then(res => {
      this.tableData = res.data.data
    })
    this.$axios({
      url: '/HrApi/Mail/Mail1',
      method: 'Get'
    }).then(res => {
      this.tableData1 = res.data.data
    })
  }
}
</script>